<?php

class template_online_listing extends theme
{

	protected function head()
	{
	?>
<!--[if IE]>
<script type="text/javascript" language="javascript" src="../js/excanvas.compiled.js"></script>
<![endif]-->
<script type="text/javascript" language="javascript" src="../js/jquery.bt.min.js"></script>

<link type="text/css" rel="stylesheet" href="apps/app/templates/default/css/online_listing.css" />
<script type="text/javascript" language="javascript" src="apps/app/templates/default/js/online_listing.js"></script>
	<?php
	}
	
	protected function center()
	{
		$app_list = $this->get('app_list');
		$installed_app = $this->get('installed_app');
		?>

		<p>
		<form action="./" method="post">
		搜索主题: <input type="text" name="key" /> <input type="submit" value="搜索">
		<input type="hidden" name="controller" value="app" />
		<input type="hidden" name="task" value="online_listing" />
		</form>
		</p>

		<ul class="app-list">
			<?php
			if(count($app_list)==0)
			{
				echo '没有记录';
			}
			else
			{
				foreach($app_list as $app)
				{
				$installed = in_array($app->id, $installed_app);
				?>
				<li id="app-<?php echo $app->id; ?>" class="<?php echo $installed?'installed':'noinstall';?>">
				<table width="100%">
				<tr>
				<td width="130">
				<div class="app-thumbnail" title="http://www.mrbone.org/<?php echo $app->image; ?>">
					<img src="http://www.mrbone.org/<?php echo $app->thumbnail; ?>" width="120" height="90">
				</div>
				</td>
				<td valign="top">
				<div class="install-button">
					<?php if(!$installed){ ?>
					<input type="button" value="安装" id="button-<?php echo $app->id; ?>" onclick="javascript:install(<?php echo $app->id; ?>)">
					<?php } ?>
				</div>
				<div class="app-title">
					<?php echo $app->name; ?>
				</div>
				
				<div class="clr"></div>
				
				<div class="app-description">
					<?php echo $app->description; ?> &nbsp; <a href="http://www.mrbone.org/?app=client_app&task=detail&app_id=<?php echo $app->id; ?>" target="_blank">详情...</a>
				</div>
				</td>
				</tr>
				</table>
				</li>
				<?php
				}
			}
			?>
			<div class="clrl"></div>
		</ul>
		
		<div class="align-center">
			<?php $this->pagination(); ?>
		</div>

		<?php
		
	}	

}
?>